Repository navigation
Routing and guidance follow the driving direction - #37
Merged
Merged
Conversation
Router::route takes an optional start heading (degrees clockwise from north). A snapped start node more than 120 degrees off it costs 60 s more, the same default penalty OsmAnd's own routers charge for starting against the initial direction, so a reroute while driving continues ahead instead of turning back to the nearest junction behind. Snap candidates now carry their node coordinates for the bearing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A route request carried only origin and destination, so a reroute while driving away from the route started from the nearest road point in whichever direction was cheapest, usually back the way the car came; every recalculation then put the turn further behind. The engine now keeps the motion heading while the car moves faster than 1.5 m/s (the camera's threshold) and for 30 s after it stops, and passes it with every route and reroute request. The worker sets it as OsmAnd's initialDirection (radians clockwise from north, the directionRoute convention) before each router, since HH clears it after a run, and gives it to the CH planner's start penalty. A parked car has no heading and routes as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Driving back along the route stays within the 50 m off-route distance, and progress never counts backwards, so guidance froze and offered no new route. The tracker now reports the route's direction at the car's progress point (not the nearest segment, which on a route returning along the other carriageway points the other way). Driving more than 120 degrees against it for 5 s while moving asks for a route in the driving direction. It does not ask again until the car has driven along a route, so a recalculated route that still begins with a U-turn stands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reroutes while driving turned back toward the nearest road point behind the car, and driving back along the route froze guidance. The car's heading is now used for routing and wrong-way detection.
initialDirectionfor HH/A* (set before each router, since HH clears it) and as the CH penalty.Tests:
make test(new cases in ch_test, reroute_state_test, navigation_ui_test); clean QNXmakewith ELF/ABI checks. Not yet run on the radio or in the car.🤖 Generated with Claude Code